using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using System.Diagnostics;
namespace PrintPreview
{
  static class Program
  {
    [STAThread]
    static void Main()
    {
      Stopwatch sw=Stopwatch.StartNew();
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      using(PrintPreviewDialog pdlg=new PrintPreviewDialog())
      using(pdlg.Document=new System.Drawing.Printing.PrintDocument())
      {
        pdlg.Document.PrintPage+=new System.Drawing.Printing.PrintPageEventHandler(Document_PrintPage);
        pdlg.PrintPreviewControl.Zoom=1.55;
        pdlg.WindowState=FormWindowState.Maximized;
        pdlg.Text="Generated in "+sw.Elapsed.TotalMilliseconds.ToString();
        Application.Run(pdlg);
      }
    }
    static void Document_PrintPage(object sender,System.Drawing.Printing.PrintPageEventArgs e)
    {
      Renderer.Render(e.Graphics,"locations and sku");
      //Renderer.Render(e.Graphics,"New DVP printers");
      //Bitmap png=new Bitmap(820,1200,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
      //Graphics g=Graphics.FromImage(png);
      //g.FillRectangle(Brushes.White,0,0,820,1200);
      //Renderer.Render(g,"Locations: MC001A - MC024B");
      //png.Save("C:\\img.png",System.Drawing.Imaging.ImageFormat.Png);
    }
  }
}